<!DOCTYPE HTML>
<html class="bg-fff">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>支付订单</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/layer.css" />
    <link rel="stylesheet" type="text/css" href="../css/mdw.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/swiper.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/layer.js"></script>
    <script type="text/javascript" src="../script/mdw.js"></script>
    <script type="text/javascript" src="../script/jumpPage.js"></script>

</head>
<body class="bg-fff">
    <header class="header">
        <div class="backPrevPage" onclick="Bank()"></div>
        <div class="pageTitle">Pay Order</div>
    </header>
    <section class="payPage HTML_BOX">
        <div class="payBtn" style="position: fixed;top:1.2rem;width:calc(100% - 0.6rem);left: 0;z-index: 10">支付完成后，点这里继续</div>
        <iframe id="content" src="" style="width: 100%;height:calc(100vh - 3.2rem);margin-top:2.2rem;border:none;overflow-y:scroll;z-index: 2;position: relative;"></iframe>
    </section>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
   
    var param={};
    apiready = function(){
        $api.fixStatusBar($api.dom('header'));
        api.setStatusBarStyle({
            color: '#fff',//设置APP状态栏背景色
            style: 'dark'
        });
        ifCnAndEn();
        param = api.pageParam || {};
        console.log(JSON.stringify(param));
        $('#content').attr('src',param.url);
    };
    $(".payBtn").click(function(){
        var p = {order_number:param.order_number};
        pop.loading();
        getAjax(Interface.pay_ok,p,function(res){
            pop.close();
            console.log(JSON.stringify(res));
            if(param.buy_type=="spell"){
                param.id= res.group_id;
                openWin('groupBuy_details','groupBuy_details.html',param);
            }else{
                openWin('ware_paySuccess','ware_paySuccess.html',param);
            }
        },function(res,err){
            
        })
    })
    //返回首页
var ci = 0;
var time1, time2;
function Bank() {
    console.log(ci);
    if (ci == 0) {
        time1 = new Date().getTime();
        ci = 1;
        console.log(ci);
        if(cnen ==1){
            api.toast({msg:'再按一次返回键放弃支付'});
        }else{
            api.toast({msg:'ayment waiver by return once more'});
        }
    } else if (ci == 1) {
        time2 = new Date().getTime();
        if (time2 - time1 < 3000) {
            var p = {order_number:param.order_number};
            pop.loading();
            getAjax(Interface.pay_ok,p,function(res){
                pop.close();
                console.log(JSON.stringify(res));
                if(param.buy_type=="spell"){
                    param.id= res.group_id;
                    openWin('groupBuy_details','groupBuy_details.html',param);
                }else{
                    openWin('ware_paySuccess','ware_paySuccess.html',param);
                }
            },function(res,err){
                historyBack();
            })
            
        } else {
            ci = 0;
            if(cnen ==1){
                api.toast({msg:'再按一次返回键放弃支付'});
            }else{
                api.toast({msg:'ayment waiver by return once more'});
            }
        }
    }
}
   
    
     
</script>
<script type="text/javascript">
    function ifCnAndEn(){
        if(cnen==2){
            $(".payBtn").eq(0).html('After payment is completed, click here to continue');
        }
    }
</script>
</html>